#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__

#include "cocos2d.h"
#include "cocos-ext.h"
#include "Model/Tree.h"
#include "Model/Cloud.h"
#include "Model/Monkey.h"
#include "Component/MonkeyCollision.h"
#include "View/PanelScore.h"
#include "Model/Vines.h"

USING_NS_CC;
USING_NS_CC_EXT;

class HelloWorld : public cocos2d::CCLayer
{
private:

	int mScore; //diem
	int mMonkeyHeath;

	CCSize mSize; //lay size man hinh sai ca class HelloWorld

	// Check swipe event
	float initialTouchPos[2];
    float currentTouchPos[2];
	bool isTouchDown;

	CCNode* monkeyNode;

	CCSize visibleSize;

	Tree* mTree;
	Tree* mTree1;

	Cloud *mCloud;

	Vines* mVines;

	UILayer* ul;

	int arrRandom[kMaxLenght];

public:

	Monkey* mMonkey;

    // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
    virtual bool init();  

    // there's no 'id' in cpp, so we recommend returning the class instance pointer
    static cocos2d::CCScene* scene();
    
    // a selector callback
    void menuCloseCallback(CCObject* pSender);

    virtual void onEnter();
    virtual void onExit();
	virtual void update(float delta);
	virtual void draw();

	virtual bool ccTouchBegan(CCTouch* touch, CCEvent* event);
	virtual void ccTouchMoved(CCTouch* touch, CCEvent* event);
	virtual void ccTouchEnded(CCTouch* touch, CCEvent* event);

    CREATE_FUNC(HelloWorld);

	void fAddMonkeyHeathUI();
	void fUpdateHeath(int mHeath);
	void fAddTree();
	void fAddTree(CCPoint p);
	void fAddCloud();
	void fAddMonkey();
	void fAddVines();

	/// setter, geteter score
	///
	/// score: diem
	/// 
	/// SetScore: thay doi diem
	/// GetScore: tra ve diem hien tai
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	
	void fSetScore(int score);
	int fGetScore();

	void fGetData();
	void fPostData();
	void onHttpRequestCompleted(cocos2d::CCNode *sender, void *data);
	void menuHttpRequestCallback(CCObject* pSender);

	void animationEvent(CCArmature *pArmature, MovementEventType movementType, const char *movementID);
};

#endif // __HELLOWORLD_SCENE_H__
